<?php

namespace app\admin\model;

use think\Model;


class MbtiResult extends Model
{

    

    

    // 表名
    protected $name = 'mbti_result';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'relation_type_text',
        'status_text'
    ];
    

    
    public function getRelationTypeList()
    {
        return ['one' => __('One'), 'group' => __('Group')];
    }

    public function getSexTypeList(){
        return ['male' => __('Male'), 'female' => __('Female')];
    }

    public function getStatusList()
    {
        return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
    }

    public function mbtiIeList()
    {
        return ['A' => __('All'), 'I' => __('Introversion'), 'E' => __('Extraversion')];
    }

    public function mbtiSnList()
    {
        return ['A' => __('All'), 'S' => __('Sensing'), 'N' => __('Intuition')];
    }

    public function mbtiTfList()
    {
        return ['A' => __('All'), 'T' => __('Thinking'), 'F' => __('Feeling')];
    }

    public function mbtiPjList()
    {
        return ['A' => __('All'), 'P' => __('Perceiving'), 'J' => __('Judging')];
    }


    public function getRelationTypeTextAttr($value, $data)
    {
        $value = $value ?: ($data['relation_type'] ?? '');
        $list = $this->getRelationTypeList();
        return $list[$value] ?? '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ?: ($data['status'] ?? '');
        $list = $this->getStatusList();
        return $list[$value] ?? '';
    }




}
